<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@ include file="/common/common-css.jsp"%>
<style>
#jquery-table td {
	cursor: pointer !important
}

.load_bg {
	background: #000;
	opacity: 0.1;
	left: 0px;
	top: 0px;
	position: fixed;
	height: 100%;
	width: 100%;
	overflow: hidden;
	z-index: 10000;
}

.load_img {
	left: 50%;
	top: 180px;
	position: fixed;
	height: 50px;
	overflow: hidden;
	z-index: 20000;
}
</style>
</head>
<body class="no-skin">
	<div class="load_bg" style="display: none;"></div>
	<img src="http://img.xmiles.cn/commentloading.gif" class="load_img"
		style="display: none" />
	<div class="page-content">
		<div id="test"></div>
		<div class="page-header"
			style="margin-bottom: 0px; padding-bottom: 10px;">

			<h1 id="fu_name"></h1>
		</div>
		<form id="queryForm" method="post">
			<div class="page-content-area">
				<div class="row">
					<div class="col-sm-12">
						<div class="widget-box"
							style="border: 0px solid #ccc; border-top: none; border-bottom: none;">
							<div class="widget-header widget-header-blue widget-header-flat">
								<h4 class="widget-title">缓存操作</h4>
								<div class="widget-toolbar">
									<a href="#" data-action="collapse"> <i
										class="ace-icon fa fa-chevron-up"></i>
									</a>
								</div>
							</div>

							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">删除的Key:</label> <input
												type="text" style="padding-left: 0px" id="del_key" name="del_key">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="del_key_button" onclick="delkey()" id="del_key_button">
												删除
											</button>
											<button class="btn btn-purple  no-border" type="button"
												name="get_key_button" onclick="getkey()" id="get_key_button">
												获取
											</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							<!-- /.widget-body -->

							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">修改set的Key:</label> <input
												type="text" style="padding-left: 0px" name="mod_key" id="mod_key">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label style="text-align: right">修改set的Value:</label> <input
												type="text" style="padding-left: 0px" name="mod_value" id="mod_value">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="mod_key_button" onclick="modkey()" id="mod_key_button">
												修改</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							<!-- /.widget-body -->

							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">修改hset的Name:</label> <input
												type="text" style="padding-left: 0px" name="mod_hset_name" id="mod_hset_name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label style="text-align: right">修改hset的Key:</label> <input
												type="text" style="padding-left: 0px" name="mod_hset_key" id="mod_hset_key">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label style="text-align: right">修改hset的Value:</label> <input
												type="text" style="padding-left: 0px" name="mod_hset_value" id="mod_hset_value">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="mod_hset_name_button" onclick="modhset()" id="mod_hset_name_button">
												修改</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							<!-- /.widget-body -->

							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">删除hset的Name</label> <input
												type="text" style="padding-left: 0px" name="del_hset_name" id="del_hset_name">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label style="text-align: right">删除hset的Key:</label> <input
												type="text" style="padding-left: 0px" name="del_hset_key" id="del_hset_key">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="del_hset_key_button" onclick="delhset()" id=del_hset_key_button>
												删除</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							<!-- /.widget-body -->

							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">List的Key:</label> <input
												type="text" style="padding-left: 0px" name="mod_llist_key" id="mod_llist_key" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label style="text-align: right">增加List的Lpush:</label> <input
												type="text" style="padding-left: 0px" name="mod_llist_lpush" id="mod_llist_lpush" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="mod_llist_key_button" onclick="modLlist()" id="mod_llist_key_button">
												增加</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							
							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">List的Key:</label> <input
												type="text" style="padding-left: 0px" name="mod_rlist_key" id="mod_rlist_key" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label style="text-align: right">增加List的Rpush:</label> <input
												type="text" style="padding-left: 0px" name="mod_rlist_rpush" id="mod_rlist_rpush" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="mod_rlist_key_button" onclick="modRlist()" id="mod_rlist_key_button">
												增加</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							<!-- /.widget-body -->
							
							<div class=" widget-body">
								<div class="widget-main">
									<div class="form-group col-xs-12 col-sm-12">
										<div class="col-sm-12">
											<label style="text-align: right">获取List的Key:</label> <input
												type="text" style="padding-left: 0px" name="get_list_key" id="get_list_key" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button class="btn btn-purple  no-border" type="button"
												name="get_list_key_button" onclick="getList()" id="get_list_key_button">
												获取</button>
										</div>
									</div>
								</div>
								<!-- /.widget-main -->
							</div>
							<!-- /.widget-body -->

						</div>
						<!-- /.widget-box -->
					</div>
					<!-- /.col-sm-12 -->
					<div class="col-md-12 center">
						<div class="clearfix form-actions"></div>
						<textarea rows="5" cols="100%" id="text"></textarea>
					</div>
				</div>
				<!-- /.row -->

			</div>
			<!-- /.page-content-area -->
		</form>
	</div>
	<!-- /.page-content -->

	<%@ include file="/common/common-js.jsp"%>
	<!-- inline scripts related to this page -->
	<script type="text/javascript">
		function delkey() {
			var key = $("#del_key").val();
			$("#del_key_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/delkey.action", {"del_key" : key}, function (data) {
				if(data.result.status == 1){
					alert('修改缓存成功！！');
					$("#del_key_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function getkey() {
			var key = $("#del_key").val();
			$("#get_key_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/getkey.action", {"get_key" : key}, function (data) {
				if(data.result.status == 1){
					$("#text").text(data.result.msg);
					$("#get_key_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function modkey() {
			var key = $("#mod_key").val();
			var value = $("#mod_value").val();
			$("#mod_key_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/modset.action", {"mod_key" : key,"mod_value" : value}, function (data) {
				if(data.result.status == 1){
					alert('修改缓存成功！！');
					$("#mod_key_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function modhset() {
			var name = $("#mod_hset_name").val();
			var key = $("#mod_hset_key").val();
			var value = $("#mod_hset_value").val();
			$("#mod_hset_name_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/modhset.action", {"mod_hset_name" : name, "mod_hset_key" : key, "mod_hset_value" : value}, function (data) {
				if(data.result.status == 1){
					alert('修改缓存成功！！');
					$("#mod_hset_name_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function delhset() {
			var name = $("#del_hset_name").val();
			var key = $("#del_hset_key").val();
			$("#del_hset_key_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/delhset.action", {"del_hset_name" : name, "del_hset_key" : key}, function (data) {
				if(data.result.status == 1){
					alert('修改缓存成功！！');
					$("#del_hset_key_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function modLlist() {
			var key = $("#mod_llist_key").val();
			var lpush = $("#mod_llist_lpush").val();
			$("#mod_llist_key_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/modllist.action", {"mod_llist_key" : key, "mod_llist_lpush" : lpush}, function (data) {
				if(data.result.status == 1){
					alert('修改缓存成功！！');
					$("#mod_llist_key_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function modRlist() {
			var key = $("#mod_rlist_key").val();
			var rpush = $("#mod_rlist_rpush").val();
			$("#mod_rlist_key_button").attr("disabled","disabled");
			$.post(ctx + "/mredis/modrlist.action", {"mod_rlist_key" : key, "mod_rlist_rpush" : rpush}, function (data) {
				if(data.result.status == 1){
					alert('修改缓存成功！！');
					$("#mod_rlist_key_button").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
	        },"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
		
		function getList() {
			var key = $("#get_list_key").val();
			$("#get_list_key").attr("disabled","disabled");
			$.post(ctx + "/mredis/getlist.action", {"get_list_key" : key}, function (data) {
				if(data.result.status == 1){
					$("#text").text(data.result.msg);
					$("#get_list_key").removeAttr("disabled");
				}else{
					alert(data.result.errorcode);//错误提示，包括服务器重启导致的session失效
				}
			},"json").error(function(){//失败处理
 		    	$(".load_bg").attr("style","display:none");
				$(".load_img").attr("style","display:none");
				alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
 			});
		}
	</script>
</body>
</html>